import React from "react";
import ReactDOM from "react-dom";
import "./index.css";
import App from "./App";
import reportWebVitals from "./reportWebVitals";

/**
 * 直接 import 引入 electron 模块 webpack 解析不了，运行主进程时会报错
 * 解决方案：
 *   1. 通过 window.require() 引入，webpack 就不会去解析 electron 的依赖
 *   2. 修改 webpack 的 Target 配置，webpack 就会做对应模块的特殊处理
 */

// 借助 customize-cra react-app-rewired 两个模块，修改 webpack 的 target 后，通过 import 引入就不会报错
// import { ipcRenderer } from "electron";
// const { ipcRenderer } = window.require("electron");

ReactDOM.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
  document.getElementById("root")
);

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
